﻿using LibNiconico.NiconicoApi;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace NiconicoApiHelper_LinkTest
{
    [TestFixture]
    public class HelperApiTest
    {

        private const string mail = "nicotestuser@mail.goo.ne.jp";
        private const string password = "niconico";

        [TestCase]
        public void ApiTest()
        {
            var helper = new NicoApiHelper();
            var response = helper.LoginAsync(mail, password).GetAwaiter().GetResult();

            Assert.IsTrue(response.Succeed);

            Assert.IsTrue(helper.IsSetAuth);



        }


        private NicoApiHelper createSetAuthHelper()
        {
            var helper = new NicoApiHelper();
            helper.LoginAsync(mail, password).GetAwaiter().GetResult();
            return helper;
        }

         
        [TestCase]
        public void SetUserSessionTest()
        {
            var helper = new NicoApiHelper();
            helper.SetUserSession(new Cookie("user_session", "1466475622"));
            Assert.IsTrue(helper.IsSetAuth);

        }


        [TestCase]
        public void ClearAuthTest()
        {
            var helper = new NicoApiHelper();
            helper.LoginAsync(mail, password).GetAwaiter().GetResult();

            Assert.IsTrue(helper.IsSetAuth);

            helper.ClearAuth();

            Assert.IsFalse(helper.IsSetAuth);


        }


    }
}
